% Replication code for Johnston, King, and Lie (2014)
% 
% Step 1: Symbolic derivatives
% ============================= 
% 
% Finding the higher order perturbation solution for your model requires
% knowledge of the corresponding numerical derivatives of the model 
% equations. We supply two pieces of code to help with this process. The
% first is adm(), which takes two functions, F() and G() as defined in the
% paper, vectors of t and t+1 dated variables, and a t+1 dated vector of
% shocks. This will produce symbolic derivatives of the F() and G()
% functions with respect to the accompanying vectors using the MATLAB 
% Symbolic Math Toolbox. It allows the researcher to specify the order of 
% differentiation, whether to use the parallel computing toolbox, and
% whether to cache and attempt to re-use derivatives if possible between
% calls. See the adm() help file for more information. 
% 
% Step 2: Numerical derivatives
% ==============================
% 
% The second step is to evaluate the symbolic derivatives from Step 1 at
% the model non-stochastic steady state. We leave it to the researcher to
% find the steady state as this is typically a problem-specific task.
% However, the script nv.m is supplied which creates arrays of double
% precision derivatives (e.g., nGFzz) from the symbolic outputs from adm(),
% provided that the default naming convention is used (e.g., GFzz). 
% 
% Step 3: Solution
% =================
% 
% The function jkl() finds the higher order perturbation approximation
% solution as described in Johnston, King, and Lie (2014). This takes
% numerical derivatives from the previous step and produces a solution in
% the form described in the appendices (see also quick_reference.pdf). 
% 
% License
% ==========
% 
% Simplified BSD License (BSD)
% Copyright (c) 2014, Michael Johnston, Robert King, and Denny Lie
% All rights reserved.
% 
% Redistribution and use in source and binary forms, with or without 
% modification, are permitted provided that the following conditions 
% are met:
% 
% * Redistributions of source code must retain the above copyright notice, 
% this list of conditions and the following disclaimer.
% 
% * Redistributions in binary form must reproduce the above copyright 
% notice, this list of conditions and the following disclaimer in the 
% documentation and/or other materials provided with the distribution.
% 
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
% PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
% HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
% SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
% TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




